<?php

class Db_Conn{
	
  private	$host="";
  private   $users="";
  private   $password="";
  private   $db_name="";
  private   $link;
  var       $sql;
  var       $result;
  
 public function __construct($host,$users,$password,$db_name){
	$this->host=$host;
  	$this->users=$users;
  	$this->password=$password;
 	$this->db_name=$db_name;
 	$this->open_db();
    
  }
  
  
  
public function open_db(){
	
	$this->link=mysql_connect($this->host,$this->users,$this->password) or die(mysql_error());
	mysql_select_db($this->db_name,$this->link) or die("Error:".mysql_error());
	return $this->link;
	
   }


public function close_db(){
	
    mysql_close($this->link) or die(mysql_error());
  } 



public function query($sql){
	$this->result=mysql_query($sql) or die(mysql_errno());
	return $this->result;
	
   }

}

$oa=new Db_Conn("localhost","root","ccfafei","iterp");
mysql_query("SET NAMES 'UTF8'");

?>